Function Name

WinC

C#

ActiveX Version

ActiveX Name(s)

Install From

Active Slider

Yes

Yes

Microsoft Visual Basic 6.0 Common Controls

Comctl32.ocx

http://www.microsoft.com/en-us/download/details.aspx?id=10019

Global Scripting

Yes

No

Microsoft Excel 2013

Excel.exe

Any Valid MS Office Install

PlexCrystalReportViewer

Yes

Yes

Crystal Reports for Visual Studio 2005 (version 10.2)

CRViewer.dll

Craxddrt.dll

MS Visual Studio 2005 Professional Install

PlexPdfViewer

Yes

Yes

Adobe Reader XI (version 11.0.03)

 

http://get.adobe.com/reader/

Scenario: Using ActiveX Controls in WinC and C# Client Applications


1.0 Introduction

2.0 How to Use ActiveX Controls in WinC and C# Client Applications

2.1 Prerequisites

3.0 Generate, Build, and Run the WinC Samples

4.0 Generate, Build, and Run the C# Samples

5.0 Copyright


1.0 Introduction

Product: CA Plex

Release: 7.2

This scenario describes how as a CA Plex Developer, you can host ActiveX controls in WinC and C# Client applications.

This scenario provides you with the following items:

This Knowledge Base Article constitutes a portion of the official CA product documentation for this CA product. This Knowledge Base Article is subject to the following notices, terms and conditions.


2.0 How to Use ActiveX Controls in WinC and C# Client Applications

As a CA Plex Developer, you can host ActiveX controls in WinC and .NET Client applications.

The following diagram illustrates how you can host ActiveX controls on the CA Plex panels:

Using ActiveX Controls


2.1 Prerequisites

To host the ActiveX controls in your .NET Client applications, ensure that you have .NET Client knowledge.

Note: For more information about the .NET Client and hosting ActiveX controls in .NET Client applications, see the sample document—An Introduction to CA Plex .NET Client. The sample document is at ...\Documents\CA\Plex\7.1\Samples\Dot Net Client\ folder.

To run the samples that are contained in this sample model, have the correct ActiveX controls that are registered on the systems that you want to run the samples on.

If you want to run the .NET Client examples that are contained in this sample, you require a valid license for the CA Plex Option for Enterprise .NET. If you do not have a license for this option, then a 30-day trial license is granted the first time that you generate a CA Plex function of language C# that scopes a panel.

In addition, install the prerequisites that are shown in the following table, to run each sample function:


3.0 Generate, Build, and Run the WinC Samples

You can generate, build, and run four different ActiveX sample functions that require six individual ActiveX controls in the WinC applications.

Example:

The following example showcases how you can:

Follow these steps:

  1. Ensure that you configured the Beginners ActiveX.mdl local model for the base variant.

    The Model Configuration dialog displays the configuration that you have set.

  2. Generate and build the 13 functions in the WinC Samples subject area.

    The functions are generated and built without any errors or warnings.

  3. Run the Active Slider function by highlighting it in the Generate and Build window and select Build, Run.

    The ActiveX Control Sample dialog opens.

  4. Move the slider to see the font size change, modify the Min and Max settings, and click OK.
  5. Host the standalone ActiveX controls on a WinC panel using the following example:
    1. In the Plex model, open the Active Slider function and the Active Slider.Top App panel.

      This standalone panel hosts two ActiveX controls—TabStrip and Slider controls, which are shipped with comctl32.ocx.

      Note:

      • The font size changes because the Slider control has the Change physical event mapped to a logical event. In the Action Diagram, the logical event calls Active Slider.DoChange, which changes the TabStrip font size based on the current Slider value. This shows how you can process events associated with ActiveX controls.
      • The Slider Min and Max properties are set in the Active Slider.SetMinMax source code. This shows how you can set ActiveX control properties based on Plex field values.
  6. Run the Global Scripting function. This example shows you how you can instantiate non-graphical ActiveX controls using Global Scripting in VBscript source code.
    1. To create an ActiveX object to interact, use the CreateObject function as follows:

      Set objXL = CreateObject("Excel.Application")

      The object is now created.

    2. Set the properties and calling methods that the object supports to interact with it in the same way as other ActiveX controls. In this example, the script is creating a simple workbook with a set of values, creating a chart from these values, and rotating the chart.

      Note: If you close the Excel spreadsheet before the rotation completes, you are prompted with a VBScript error.

  7. Before you run the PlexCrystalReportViewer function, ensure that you have run the Dot Net Client sample and added some sample data.

    Note: If you are not licensed to use the CA Plex Option for .NET Enterprise, you can still generate and build the sample in the WinC or WinC/WinNTC variant and add data.

    The MDI Parent dialog shows some sample Order Header data added to the Dot Net Client sample:

    1. Run the PlexCrystalReportViewer function.

      The Panel dialog opens prompting you to enter your ODBC connection details.

    2. Provide the same details that you used for the Dot Net Client sample and click OK.

      The main function launches.

    3. Load a report to run by selecting File, Open… and navigating to a Crystal Report .RPT file.

      A sample report is shipped with the sample model in the ...\Beginners ActiveX\Resources\OrderHeaderReport.rpt location.

    4. Select the report to load into the viewer.

      The CA Plex Viewer dialog opens displaying the sample report.

  8. Review the PlexCrystalReportViewer.Scripts.Crystal_OpenReport script.

    Note:

  9. Run the PlexPdfViewer function.

    This function works similarly to the PlexCrystalReportViewer example.

    1. Select File, Open… and navigate to a PDF document to open.

      The selected document opens in the Adobe PDF Reader ActiveX Viewer.

  10. Review the PlexPdfViewer.Scripts.AcroPDF_LoadFile script.

    This script shows you how you can call ActiveX control methods, passing Plex field values as parameters.

You have now generated, built, and ran four different ActiveX sample functions that required six individual ActiveX controls.


4.0 Generate, Build, and Run the C# Samples

Use the following example to generate, build, and run C# samples using the ActiveX controls.

Example:

The following example showcases how you can:

Follow these steps:

  1. Ensure that you configured the Beginners ActiveX.mdl local model for the .NET Client.

    The Model Configuration dialog displays the configuration that you have set.

  2. Generate and build the seven functions in the C# Samples subject area.

    The functions are generated and built without any errors or warnings.

  3. Run the Active Slider function by highlighting it in the Generate and Build window and select Build, Run.

    The ActiveX Control Sample dialog opens.

  4. Move the slider to see the font size change, modify the Min and Max settings, and click OK.
  5. Host the standalone ActiveX controls on a C# panel using the following example:
    1. In the Plex model, open the Active Slider function and the Active Slider.Top App panel.

      This standalone panel hosts two ActiveX controls—TabStrip and Slider controls, which are shipped with comctl32.ocx.

      Note:

      • The font size changes because the Slider control has the Change physical event mapped to a logical event. In the Action Diagram, the logical event calls the source code object Active Slider.WpfDoChange, which changes the TabStrip font size based on the current Slider value. This shows how you can process events associated with ActiveX controls.
      • The Slider Min and Max properties are set in the source code Active Slider.WpfSetMinMax. Compare the syntax of Active Slider.WpfSetMinMax with Active Slider.SetMinMax. This shows how you can set ActiveX control properties based on Plex field values and also an example of how C# and VBscript syntax differs.
  6. Run the PlexCrystalReportViewer function.

    Before you run the PlexCrystalReportViewer function, ensure that you had run the Dot Net Client sample and added some sample data.

    Note: If you are not licensed to use the CA Plex Option for .NET Enterprise, you can still generate and build the sample in the WinC or WinC/WinNTC variant and add data. If you have already created a sample, you can reuse it.

    The MDI Parent dialog shows some sample Order Header data added to the Dot Net Client sample:

    1. Run the PlexCrystalReportViewer function.

      The Panel dialog opens prompting you to enter your ODBC connection details.

    2. Provide the same details that you used for the Dot Net Client sample and click OK.

      The main function launches.

    3. Load a report to run by selecting File, Open… and navigating to a Crystal Report .RPT file.

      A sample report is shipped with the sample model in the ...\Beginners ActiveX\Resources\OrderHeaderReport.rpt location.

    4. Select the report to load into the viewer.

      The CA Plex Viewer dialog opens displaying the sample report.

  7. Review the PlexCrystalReportViewer.Scripts.WPFCrystal_OpenReport script.

    Note:

  8. Run the PlexPdfViewer function.

    This function works similar to the PlexCrystalReportViewer example.

    1. Select File, Open… and navigate to a PDF document to open.

      The selected document opens in the Adobe PDF Reader ActiveX Viewer.

  9. Review the PlexPdfViewer.Scripts.WPFAcroPDF_LoadFile script and compare it with PlexPdfViewer.Scripts.AcroPDF_LoadFile. This script shows you how you can call ActiveX control methods from C# source code, passing Plex field values as parameters. It also shows the differences in syntax between C# and VBscript source code required to interact with ActiveX controls.

You have now generated, built, and ran the C# ActiveX sample functions using the ActiveX controls.


5.0 Copyright

Copyright © 2014 CA. All rights reserved. All trademarks, trade names, service marks, and logos referenced herein belong to their respective companies.